import {createLogger,format,transports} from 'winston'

const myFormat = format.printf(info => {
  return `${info.timestamp} ${info.level} ${info.message}`
})

const logger = createLogger({
  level: "info",
  format: format.combine(
    format.timestamp({format: "YYYY-MM-DD HH:mm:ss"}),
    myFormat
  ),
  transports: [
    new transports.Console(),
    new transports.File({filename: "./logs/log.txt"})
  ]
})

export default logger